<?php
/**
 * Holds abstract class Cache_Container
 *
 * @author daantimmer
 *
 * @package Library
 * @subpackage Cache
 */

/**
 *
 *
 * @author daantimmer
 */
abstract class Cache_Container{
	
	private static $instance;
	
	protected function __construct(){}
	
	public static function instance($class = __CLASS__){
		if(self::$instance == null)
			self::$instance = new $class();
		return self::$instance;
	}
	
	/**
	 * @return boolean
	 */
	public abstract function isAvailable();
	
	/**
	 * @param Cache_Key $key
	 * @param mixed $data
	 * @param integer $timeout
	 * @return void
	 */
	public abstract function write(Cache_Key $key,&$data,$timeout);
	public abstract function read(Cache_Key $key);
	public abstract function remove(Cache_Key $key);
	public abstract function gc();
	
	/**
	 * Returns current cache statistics
	 *
	 * @return mixed
	 */
	public abstract function getStatistics();
	
	/**
	 * clears the whole cache
	 *
	 * @return boolean
	 */
	public abstract function clear();
}